Skip to content

refactor: move into npm workspace #1304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 19, 2022
Merged

refactor: move into npm workspace #1304

merged 9 commits into from
Apr 19, 2022

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Apr 11, 2022

Summary

This PR moves the plugin and one demo site into an npm workspace, to make it easier to manage packages, and to better handle dependency caching.

Before it can be merged the release please scripts and config need changing to reflect the fact that the plugin isn't in the root.

Test plan

This will involve ensuring all the demo sites build properly

Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal

caviforms

Standard checks:

  • Check the Deploy Preview's Demo site for your PR's functionality
  • Add docs when necessary

🧪 Once merged, make sure to update the version if needed and that it was published correctly.

@netlify
Copy link

netlify bot commented Apr 11, 2022

Deploy Preview for netlify-plugin-nextjs-demo canceled.

Name Link
🔨 Latest commit aa5d528
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/625e6e7559ead20009724758

@netlify
Copy link

netlify bot commented Apr 11, 2022

Deploy Preview for netlify-plugin-nextjs-export-demo ready!

Name Link
🔨 Latest commit aa5d528
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/625e6e75af260200083c2f04
😎 Deploy Preview https://deploy-preview-1304--netlify-plugin-nextjs-export-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Apr 11, 2022

Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!

Name Link
🔨 Latest commit aa5d528
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/625e6e7514bf2700094a3f96
😎 Deploy Preview https://deploy-preview-1304--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Apr 11, 2022

Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!

Name Link
🔨 Latest commit aa5d528
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/625e6e756477ce00082756d5
😎 Deploy Preview https://deploy-preview-1304--netlify-plugin-nextjs-static-root-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ascorbic ascorbic requested a review from a team April 11, 2022 16:04
@ascorbic ascorbic force-pushed the mk/workspace branch 2 times, most recently from a1bc47a to eee8c37 Compare April 11, 2022 16:10
@cypress
Copy link

cypress bot commented Apr 11, 2022



Test summary

2 20 0 0


Run details

Project netlify-plugin-nextjs-default-demo
Status Failed
Commit a4fdb3b ℹ️
Started Apr 19, 2022 8:04 AM
Ended Apr 19, 2022 8:06 AM
Duration 01:46 💡
OS Linux Ubuntu - 20.04
Browser Chrome 100

View run in Cypress Dashboard ➡️


Failures

i18n.spec.ts Failed
1 Localization > should use sub routing to determine current locale
2 Localization > should use the NEXT_LOCALE cookie to determine the default locale
3 Localization > should use the NEXT_LOCALE cookie over Accept-Language header to determine the default locale
rewrites-redirects.spec.ts Failed
1 Rewrites and Redirects > rewrites: points /old to /
2 Rewrites and Redirects > redirects: redirects /redirectme to /
preview.spec.ts Failed
1 Preview Mode > enters and exits preview mode
images.spec.ts Failed
1 next/images > should show static image from /public
2 next/images > should show image using next/image
default.spec.ts Failed
1 Default site > loads home page
2 Default site > sets NODE_ENV
This comment includes only the first 10 test failures. See all 20 failures in the Cypress Dashboard.

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@cypress
Copy link

cypress bot commented Apr 11, 2022



Test summary

7 0 0 0


Run details

Project netlify-plugin-nextjs-static-demo
Status Passed
Commit a4fdb3b ℹ️
Started Apr 19, 2022 8:05 AM
Ended Apr 19, 2022 8:06 AM
Duration 01:13 💡
OS Linux Ubuntu - 20.04
Browser Chrome 100

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@cypress
Copy link

cypress bot commented Apr 11, 2022



Test summary

2 0 0 0


Run details

Project netlify-plugin-nextjs-nx-monorepo-demo
Status Passed
Commit a4fdb3b ℹ️
Started Apr 19, 2022 8:06 AM
Ended Apr 19, 2022 8:07 AM
Duration 01:10 💡
OS Linux Ubuntu - 20.04
Browser Chrome 100

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

Copy link

@ericapisani ericapisani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question so far 😄

@@ -0,0 +1 @@
17.9.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this perhaps be set to v16 so that this is on an LTS version of node? Or is there something about v17 that we want for these changes?

Depending on when it's looking like these changes will be merged and released we might be able to even go up to the newest LTS version (v18) which will be released on the April 19th.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I did this because I thought it needed to be 17 for workspaces to work properly, but I think 16 should be ok. Good point re 18 though. We should probably migrate later.

I still need to work out the best way to run the node 12 tests though, because right now they're failing as they don't support workspaces at all.

@ascorbic ascorbic force-pushed the mk/workspace branch 3 times, most recently from 4e88f7a to 2a7d5d1 Compare April 11, 2022 20:14
@ascorbic ascorbic force-pushed the mk/workspace branch 6 times, most recently from 43bdd60 to 1863b7e Compare April 12, 2022 10:17
@ascorbic ascorbic added the type: chore work needed to keep the product and development running smoothly label Apr 12, 2022
@@ -23,13 +23,20 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
- name: Installing with latest Node.js
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so we can use workspaces, which require node 16, but still run tests in node 12

"test": "run-s build build:demo test:jest",
"build": "npm run -w @netlify/plugin-nextjs build",
"postinstall": "run-s build install-husky",
"install-husky": "if-env CI=1 || husky install node_modules/@netlify/eslint-config-node/.husky",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was causing issues installing this in CI

@ascorbic ascorbic marked this pull request as ready for review April 12, 2022 10:32
@ascorbic ascorbic requested a review from ericapisani April 12, 2022 10:32
@ascorbic ascorbic requested a review from a team April 12, 2022 11:51
ericapisani
ericapisani previously approved these changes Apr 12, 2022
Copy link

@ericapisani ericapisani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM 🚀 Appreciate the workaround to support workspaces with a modern version of node while still running tests in npm v12. Fortunately we won't have to support v12 for too much longer since it will have reached end of life at the end of the month 🥳

@ascorbic
Copy link
Contributor Author

Yeah, hopefully that means Next will drop support soon! Right now we're matching the minimum version supported by the latest version of each framework, so Gatsby uses 14

@@ -16,25 +16,27 @@ jobs:
id: release
with:
token: ${{ steps.get-token.outputs.token }}
release-type: node
package-name: '@netlify/plugin-nextjs'
command: manifest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're changing to manifest releases because the package is in a subdirectory

@ascorbic ascorbic requested a review from krider2010 April 19, 2022 08:08
Copy link

@krider2010 krider2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Let's 🚢

@kodiakhq kodiakhq bot merged commit aab72e7 into main Apr 19, 2022
@kodiakhq kodiakhq bot deleted the mk/workspace branch April 19, 2022 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: chore work needed to keep the product and development running smoothly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants